package com.lantosec.hmrp.modules.system.entity;

import com.lantosec.hmrp.core.mvc.BaseEntity;
import com.lantosec.hmrp.modules.system.vo.SysDeptVO;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;

/**
 * <p>
 * 部门表 实体类
 * </p>
 *
 * @author AutoCode
 * @since 2020-02-12
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class SysDept extends BaseEntity<SysDeptVO> {

    private static final long serialVersionUID = 1L;
    public SysDept(SysDeptVO vo){
        this.deptId = vo.getDeptId();
        this.deptCode = vo.getDeptCode();
        this.deptName = vo.getDeptName();
        this.parentId = vo.getParentId();
        this.deptType = vo.getDeptType();
        this.leaf = vo.getLeaf();
        this.remark = vo.getRemark();
        this.positions = vo.getPositions();
        this.deptOrder = vo.getDeptOrder();
        this.flag = vo.getFlag();
    }

    @Override
    public SysDeptVO convertToVO(){
        return new SysDeptVO(this);
    }


    /**
     * 部门ID
     */
    @TableId(value = "dept_id", type = IdType.ASSIGN_UUID)
    private String deptId;

    /**
     * 部门编码
     */
    private String deptCode;

    /**
     * 部门名称
     */
    private String deptName;

    /**
     * 上级ID
     */
    private String parentId;

    /**
     * 部门类型
     */
    private String deptType;

    /**
     * 是否末级(0否1是)
     */
    private Integer leaf;

    /**
     * 备注
     */
    private String remark;

    /**
     * 职位列表
     */
    private String positions;

    /**
     * 排序
     */
    private Integer deptOrder;

    /**
     * 是否删除
     */
    private Boolean flag;


    public enum ColName {
        dept_id, dept_code, dept_name, parent_id, dept_type, leaf, remark, positions, dept_order, flag,
    }
}
